import request from "@/utils/request";
import type {
  ReqTrademarkType,
  TrademarkItem,
  AllTrademarkList,
} from "./type/trademarkType";
// enum 枚举
// 统一请求接口地址
const enum Api {
  getTrademarkList = "/admin/product/baseTrademark",
  addTrademark = "/admin/product/baseTrademark/save",
  updateTrademark = "/admin/product/baseTrademark/update",
  delTrademark = "/admin/product/baseTrademark/remove",
  getCategory1List = "/admin/product/getCategory1",
  getCategory2List = "/admin/product/getCategory2",
  getCategory3List = "/admin/product/getCategory3",
  getAllTrademarkList = "/admin/product/baseTrademark/getTrademarkList",
}
// 获取品牌数据
export const getTrademarkListApi = (page: number, limit: number) => {
  return request.get<never, ReqTrademarkType>(
    Api.getTrademarkList + `/${page}/${limit}`
  );
};
// 添加品牌
export const addTrademarkApi = (logoUrl: string, tmName: string) => {
  return request.post<never, TrademarkItem>(Api.addTrademark, {
    logoUrl,
    tmName,
  });
};
// 修改品牌
export const updateTrademarkApi = (data: TrademarkItem) => {
  return request.put<never, TrademarkItem>(Api.updateTrademark, data);
};
// 删除品牌
export const delTrademarkApi = (id: number) => {
  return request.delete<never, null>(Api.delTrademark + `/${id}`);
};
// 获取全部品牌
export const getAllTrademarkListApi = () => {
  return request.get<never, AllTrademarkList>(Api.getAllTrademarkList);
};
